package com.sikaryofficial.backend.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author : qinjinyuan
 * @desc : 举报业务类型
 * @date : 2023/11/04 10:08
 */
@Getter
@AllArgsConstructor
public enum ReportBusinessTypeEnum {

    PRODUCT(0, "Product"),
    /**
     * 业务类型：1-店铺,2-评论,3-评论回复,4-仿品举报
     */
    STORE(ReportConstant.STORE_EVALUATE_TYPE, "Store"),
    EVALUATE(ReportConstant.EVALUATE_TYPE, "evaluate"),
    EVALUATE_REPLY(ReportConstant.EVALUATE_REPLY_TYPE, "evaluateReply"),
    COUNTERFEIT_REPORTING(ReportConstant.COUNTERFEIT_REPORTING_TYPE, "counterfeitReport"),

    ARTICLE(ReportConstant.ARTICLE_TYPE, "articleReport"),
    ARTICLE_EVALUATE(ReportConstant.ARTICLE_EVALUATE_TYPE, "articleEvaluateReport"),
    ARTICLE_EVALUATE_REPLY(ReportConstant.ARTICLE_EVALUATE_REPLY_TYPE, "articleEvaluateReplyReport")
    ;

    private final Integer businessType;
    private final String description;

    public static ReportBusinessTypeEnum getEnum(Integer code) {
        return Arrays.stream(ReportBusinessTypeEnum.values())
                .filter(pointRuleEnum -> Objects.nonNull(code) && pointRuleEnum.getBusinessType().equals(code))
                .findFirst().orElse(null);
    }
}
